﻿using System;
using System.Collections.Generic;
using HomeWork;


class Program
{
    static int a = 4;
    static int b = 7;

    #region jichu
    static void Conterl()
    {

        if (a > b)
        {
            Console.WriteLine(a + b);
        }
        else
        {
            Console.WriteLine(a * b);

        }


        for(int i = 0; i <= 10; i++)
        {
            Console.WriteLine(i);
        }


        switch (a)
        {
            case 1:
                Console.WriteLine("switch print :"+a);
                break;
            case 3:
                Console.WriteLine("switch print :"+a);
                break;
            default:
                Console.WriteLine("switc check false");
                break;

        }

        while(a <= 10){
            Console.WriteLine(a);
            a++;
        }


        do
        {

            Console.WriteLine("do while print " + a);
            a=a-1;

        } while (a>=0);



    }

    #endregion

    static int Add(int a,int b)
    {
        return a + b;
    }

    static string Attack()
    {
        Console.WriteLine("Null");
        return "Null";
    }
    static string Attack(string name)
    {
        Console.WriteLine("Name is :"+name);
        return name;

    }
    static string Attack(string name,int age)
    {
        Console.WriteLine("Name is :"+name+"Age is :"+age);
        return name;

    }


    //public struct People
    //{
    //    public string name;
    //    public int hp;
    //    public int level;
    //}

    //public enum JOB
    //{
    //    JIANHUN,
    //    HONGYAN,
    //    XIAZI,
    //    GUIQI,

    //}



//public class Ren
//    {

//        public string name;
//        public int age;


//        public Ren (string Name,int Age)
//        {
//            name = Name;
//            age = Age;
//        }

//        public void SayName()
//        {
//            Console.WriteLine("Name is :"+name);
//        }

//        public void SayName(int age)
//        {
//            Console.WriteLine("Name is :" + name + "Age is :" + age);
//        }

//        public  void AllName(string OtherName)
//        {
//            Console.WriteLine("My name is "+name+"other name is  " +OtherName);
//        }




//    }

    public class Monster
    {
        public int hp;

        public string name;

        //virtual 声明可以被重写的函数
        public virtual void Attack(string name)
        {
            Console.WriteLine("You attack    " + name);
        }
    }

    public class Boss : Monster
    {

        //使用override 重写方法
        public override void Attack(string name)
        {
            base.Attack(name);
            Console.WriteLine("Boss attack " + name);
        }

        public void End()
        {
            Console.WriteLine("end");
        }
    }

  

    static void Main(string[] args)
    {
        //Conterl();
        //int num = 0;
        // num=Add(10, 23);
        //Console.WriteLine(num);
        //Console.WriteLine(Attack());
        //Console.WriteLine(Attack("Lisheng"));
        //Console.WriteLine(Attack("Lisheng", 28));


        //People ZhangSan;
        //ZhangSan.name = "zhangsan";
        //ZhangSan.level = 1;
        //ZhangSan.hp =100;
        //Console.WriteLine(ZhangSan.name);

        //JOB hero1 = JOB.JIANHUN;
        //Console.WriteLine(hero1);

        //Ren lisheng = new Ren("lisheng",28);
        //Ren ming = new("ming", 20);
        //lisheng.AllName(ming.name);
        //  Boss li=new Boss();
        //li.Attack("zhangsan");
        //li.End();


        //WorkMonster zhang = new WorkMonster();

        //zhang.Attack();

        //WorkBoss li = new WorkBoss();
        //li.Attack();

        //Worker2Monster w1 = new Worker2Monster();
        //Console.WriteLine(w1.Set);
        //Console.WriteLine(w1.Set=100);



        //Milk mile = new Milk();
        //Water water = new Water();
        //water.AddSolt();
        //water.AddSuger();
        //mile.AddSuger();


        ////数组

        //int[] num1 = new int[] { 1, 2, 3, 4 };
        //int[] num2 = new int[10];

        //num1[1] = 20;
        //Console.WriteLine(num1[1]);

        //string[] st1 = new string[] { "zhangsan", "lisi" };
        //string[] st2 = new string[10];

        //st1[1] = "qishi";
        //Console.WriteLine(st1[1]);

        ////遍历
        //for (int i=0; i < num1.Count(); i++)
        //{
        //    Console.WriteLine(num1[i]);
        //}

        ////列表

        //List<int> l1 = new List<int>() { 1, 2, 3, 4 };
        //l1.Add(23);
        //Console.WriteLine(l1[4]);
        //l1.Remove(1);
        //Console.WriteLine(l1[0]);
        //l1.RemoveAt(2);
        //Console.WriteLine(l1.Count());

        ////堆
        //Stack<HomeWork.Worker2Monster> s1 = new Stack<Worker2Monster>();

        //s1.Push(new HomeWork.Worker2Monster() { SetName = "zhangsan" });
        //s1.Push(new HomeWork.Worker2Monster() { SetName = "lisi" });
        //s1.Push(new HomeWork.Worker2Monster() { SetName = "wangwu" });
        //Console.WriteLine(s1.Count);


        //HomeWork.Worker2Monster r1 = s1.Pop();

        //Console.WriteLine(r1.SetName);

        //Console.WriteLine(s1.Count);


        //队列
        //Queue<int> MyQueue = new Queue<int>();

        //MyQueue.Enqueue(10);
        //MyQueue.Enqueue(20);

        //Console.WriteLine(MyQueue.Count());
        //Console.WriteLine(MyQueue.Dequeue());
        //Console.WriteLine(MyQueue.Count());


        //字典

        Dictionary<int, string> d1 = new Dictionary<int, string>() { };

        Dictionary<int, string> d2 = new Dictionary<int, string>() { { 1, "zhangsan" }, { 2, "lisi" } };

        Dictionary<int, HomeWork.Worker2Monster> d3 = new Dictionary<int, HomeWork.Worker2Monster>()
        {
            { 1,new HomeWork.Worker2Monster(){SetLevel=10,SetName="boss"} },
            { 2,new HomeWork.Worker2Monster() { SetLevel=999,SetName="hello boss"} }

            };


        foreach (var item in d3)
        {
            Console.WriteLine(item.Key + "-" + item.Value.lv+":"+item.Value.name);
        }


        //d1.Add(1, "zhangsan");
        //Console.WriteLine(d1[1]);
        //Console.WriteLine(d2[2]);
        //Console.WriteLine(d3[2].name);









    }
}
